<?
$isCurrent = false;
if ($currentRound == $round) {
	$isCurrent = true;
}
$fixture = getRoundResults($leagueId, $round);
$lastRound = -1;

?>
<script>
function goToRound() {
	document.location.href = "homePage.php?round=" + document.getElementById("roundVal").options[document.getElementById("roundVal").selectedIndex].value + "#tabs-DisplayRound";
}
</script>
<br>
<br>
<br>
<table align="center" width="60%">
<tr>
			<td><select id="roundVal">
				<?if ($leagueId == 4) {?>
			    	<option value="51" <?if ($round == 51) {?>selected<?}?>>Pre Season Week1</option>
			    	<option value="53" <?if ($round == 53) {?>selected<?}?>>Pre Season Week2</option>
			    <?} else if ($leagueId == 8) {?>
			    	<option value="1" <?if ($round == 1) {?>selected<?}?>>1</option>
			    <?}?>
				<option value="2" <?if ($round == 2) {?>selected<?}?>>2</option>
				<option value="3" <?if ($round == 3) {?>selected<?}?>>3</option>
				<option value="4" <?if ($round == 4) {?>selected<?}?>>4</option>
				<option value="5" <?if ($round == 5) {?>selected<?}?>>5</option>
				<option value="6" <?if ($round == 6) {?>selected<?}?>>6</option>
				<option value="7" <?if ($round == 7) {?>selected<?}?>>7</option>
				<option value="8" <?if ($round == 8) {?>selected<?}?>>8</option>
				<option value="9" <?if ($round == 9) {?>selected<?}?>>9</option>
				<option value="10" <?if ($round == 10) {?>selected<?}?>>10</option>
				<option value="14" <?if ($round == 14) {?>selected<?}?>>14</option>
				<option value="15" <?if ($round == 15) {?>selected<?}?>>15</option>
				<option value="16" <?if ($round == 16) {?>selected<?}?>>16</option>
				<option value="17" <?if ($round == 17) {?>selected<?}?>>17</option>
				<option value="18" <?if ($round == 18) {?>selected<?}?>>18</option>
				<option value="19" <?if ($round == 19) {?>selected<?}?>>19</option>
			</select>&nbsp;<input type="button" value="Go" onclick="goToRound()">
		</td> 
		</tr>		
	<?echo displayRoundForFixture($fixture);?>
	</table><br><br>
	<?if ($round <= $currentRound) {?>
	<table width="60%" align="center">
		<?
		for ($i = 0; $i < $count; $i++) {?>
			<tr><td><h2><?echo $fixture[$i]->homeTeamName?></h2></td><td><h2><?echo $fixture[$i]->awayTeamName?></h2></td</tr>
			<tr><td width="50%" valign="top"><table>
			<?
			$replacementString = "";
			$count2 = count($fixture[$i]->homePlayerScores->playerScores);
			for ($j = 0; $j < $count2; $j++) {
				if ($fixture[$i]->homePlayerScores->playerScores[$j]->replacementFor != null) {
					$replacementString .= "<tr><td><i>" . getPlayerDisplayForPlayer($fixture[$i]->homePlayerScores->playerScores[$j]->player) . " <br>replacement for " . getPlayerDisplayForPlayer($fixture[$i]->homePlayerScores->playerScores[$j]->replacementFor) . "</i></td></tr>"; 		
				}
				if ($fixture[$i]->homePlayerScores->playerScores[$j]->score > 0) {
			?>
			<tr><td><?echo getPlayerDisplayForPlayer($fixture[$i]->homePlayerScores->playerScores[$j]->player)?></td><td><?echo $fixture[$i]->homePlayerScores->playerScores[$j]->score?></td></tr>				
			<?} else {?>
			<tr><td><font color="red"><?echo $fixture[$i]->homePlayerScores->playerScores[$j]->player->playerFirstName . " " . $fixture[$i]->homePlayerScores->playerScores[$j]->player->playerSurname . " (" . getAFLTeam($fixture[$i]->homePlayerScores->playerScores[$j]->player->team) . ")"?></font></td><td><?echo $fixture[$i]->homePlayerScores->playerScores[$j]->score?></td></tr>				
			<?}
			}?>
			<?echo $replacementString;?>
			<tr><td><hr></td></tr>
			<?
			$count2 = count($fixture[$i]->homePlayerScores->nonScoringPlayers);
			for ($j = 0; $j < $count2; $j++) {
				if ($fixture[$i]->homePlayerScores->nonScoringPlayers[$j] != null && $fixture[$i]->homePlayerScores->nonScoringPlayers[$j]->score > 0) {?>				
			<tr><td><?echo getPlayerDisplayForPlayer($fixture[$i]->homePlayerScores->nonScoringPlayers[$j]->player)?></td><td><?echo $fixture[$i]->homePlayerScores->nonScoringPlayers[$j]->score?><?if ($fixture[$i]->homePlayerScores->nonScoringPlayers[$j]->emergency) {?>&nbsp;<img src="../../../images/red-e.JPG" /><?}?></td></tr>				
			<?}
			}?>			
			</table><br><br></td>
			<td width="50%" valign="top"><table>
			<?
			$replacementString = "";
			$count2 = count($fixture[$i]->awayPlayerScores->playerScores);
			for ($j = 0; $j < $count2; $j++) {
				if ($fixture[$i]->awayPlayerScores->playerScores[$j]->replacementFor != null) {
					$replacementString .= "<tr><td><i>" . getPlayerDisplayForPlayer($fixture[$i]->awayPlayerScores->playerScores[$j]->player) . " <br>replacement for " . getPlayerDisplayForPlayer($fixture[$i]->awayPlayerScores->playerScores[$j]->replacementFor) . "</i></td></tr>"; 		
				}
				if ($fixture[$i]->awayPlayerScores->playerScores[$j]->score > 0) {?>
			<tr><td><?echo getPlayerDisplayForPlayer($fixture[$i]->awayPlayerScores->playerScores[$j]->player)?></td><td><?echo $fixture[$i]->awayPlayerScores->playerScores[$j]->score?></td></tr>
			<?}
			}?>
			<?echo $replacementString;?>
			<tr><td><hr></td></tr>
			<?$count2 = count($fixture[$i]->awayPlayerScores->nonScoringPlayers);
			for ($j = 0; $j < $count2; $j++) {
				if ($fixture[$i]->awayPlayerScores->nonScoringPlayers[$j] != null && $fixture[$i]->awayPlayerScores->nonScoringPlayers[$j]->score > 0) {?>
			<tr><td><?echo getPlayerDisplayForPlayer($fixture[$i]->awayPlayerScores->nonScoringPlayers[$j]->player)?></td><td><?echo $fixture[$i]->awayPlayerScores->nonScoringPlayers[$j]->score?><?if ($fixture[$i]->awayPlayerScores->nonScoringPlayers[$j]->emergency) {?>&nbsp;<img src="../../../images/red-e.JPG" /><?}?></td></tr>				
			<?}
			}?>			
			</table><br><br></td></tr>
		<?}
	}?>	
	</tr>
</table>
